//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    /* 用于接收二维码的字段 */
    result: ''
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },

  /*电子核销*/
  eCodeAction: function() {
    wx.navigateTo({
      url: '../ECode/eCode'
    })
  },
  /*扫码核销*/
  scanCodeAction: function() {
    // wx.navigateTo({
    //   url: '../logs/logs'
    // })
    var _this = this;
    
    wx.scanCode({
      success: (res) => {
        var result = res.result;
 
        _this.setData({
          result: result,
        })
      }
    })
  },
  /*核销查询*/
  checkSellQueryAction: function() {
    wx.navigateTo({
      url: '../CheckSellQuery/checkSellQuery'
    })
  },
  /*核销统计*/
  checkSellTableAction: function() {
    wx.navigateTo({
      url: '../CheckSellStatistics/checkSellStatistics'
      // url: '../xuzhiwen/xuzhiwen'
    })
  },

  logoutAction: function() {
    wx.showModal({
      title: '提示',
      content: '您确定要退出登录吗',
      success: function (res) {
        if (res.confirm) {//这里是点击了确定以后
          wx.setStorageSync('token', '');//将token置空
          wx.redirectTo({
            url: '../index/index',//跳去登录页
          })
        } else {//这里是点击了取消以后

        }
      }
    })
  },

  onLoad: function () {

  }
})
